import cn.edu.zut.cs.Business.SaleService;
import cn.edu.zut.cs.Model.book;
import org.testng.annotations.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import  org.springframework.test.context.testng.AbstractTestNGSpringContextTests;

import static org.junit.Assert.assertTrue;

@ContextConfiguration("classpath*:de-context.xml")
public class beantest extends AbstractTestNGSpringContextTests{

    @Autowired
    book BOOK;

    @Autowired
    SaleService service;

    @Test
    public void btest(){
        BOOK.setName("java ee");
        assertTrue(BOOK!=null) ;
    }

    @Test
    public void insert(){
        BOOK.setIsdn("000001");
        BOOK.setName("c++");
        BOOK.setPrice(60);
        service.insert(BOOK);
    }

    @Test
    public void onSale(){
        service.onSale(0.5f);
    }

}
